// Copyright © yanghy. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.

package bean

import "github.com/energye/designer/consts"

// 表示UI组件的结构
type TUIComponent struct {
	Name       string               `json:"name"`            // 组件名称
	ClassName  string               `json:"class_name"`      // 组件类名
	Type       consts.ComponentType `json:"type"`            // 组件类型
	Properties []TProperty          `json:"properties"`      // 组件属性列表
	Child      []TUIComponent       `json:"child,omitempty"` // 组件子组件列表
}

// 组件属性
type TProperty struct {
	Name   string                  `json:"name"`              // 属性名称
	Value  any                     `json:"value"`             // 属性值
	Type   consts.PropertyDataType `json:"type"`              // 属性类型
	NoCode bool                    `json:"no_code,omitempty"` // 是否生成代码, true: 不生成, false 生成
}
